var app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    windowWidth: 0,
    windowHeight: 0,
    t_status: false,
    isopera: false,
    id:""
  },
  yishen:function(){
    var that = this;
    var y_id = that.data.id;
    wx.navigateTo({
      url: '/hyb_yl/yaoshi/pages/docorder/docorder?y_id='+y_id+'&typs=yishen',
    })
  },
  tixian:function(){
    var that = this;
    var y_id = that.data.id;
    var money = that.data.yaoshi.money;
    if(money == '0.00')
    {
      wx.showModal({
        title: '提示',
        content:"您的余额为零"
      })
    }else{
      wx.navigateTo({
        url: '/hyb_yl/yaoshi/pages/my_ti/my_ti?y_id='+y_id,
      })
    }
    
  },
  shenhe:function(){
    var that = this;
    var y_id = that.data.id;
    wx.navigateTo({
      url: '/hyb_yl/yaoshi/pages/docorder/docorder?y_id='+y_id+'&typs=shenhe',
    })
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    //执行号码绑定
    app.util.request({
      'url': 'entry/wxapp/index.base',
      success: function (res) {
        console.log(res)
        that.setData({
          base: res.data
        })
      }
    })
    that.getyaoshi()
    var bgc = wx.getStorageSync('color')
    this.setData({
      bg_color:bgc
    })
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
  },
  
 
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getyaoshi()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  getyaoshi(e) {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/yaoshi.index',
      data: {
        openid: wx.getStorageSync('openid'),
      },
      success: function (res) {
        
        var yid = res.data.id
        wx.setStorageSync('yid', yid)
        that.setData({
          yaoshi: res.data,
          id: res.data.id,
          thumb:res.data.thumb
        })
      }
    })
  },
  goExplanation: function () {
    var that = this;
    var zid = that.data.zid
    wx.navigateTo({
      url: "/hyb_yl/backstageFollowUp/pages/explanation/explanation?zid=" + zid,
      success: function () {
        that.setData({
          nonReadBoo: !0
        });
      }
    });
  },
  hzwenzhen(e) {
    var that = this
    console.log(e)
    var title = e.currentTarget.dataset.title
    var keyword = e.currentTarget.dataset.keyword
    var did = e.currentTarget.dataset.did
    wx.navigateTo({
      url: '/hyb_yl/lvtongserver/pages/docorder/docorder?title=' + title + '&keyword=' + keyword + '&did=' + did,
    })
  },
  goBack: function (e) {
    var that = this
    console.log(e)
    var titlme = e.currentTarget.dataset.titlme
    var key_words = e.currentTarget.dataset.key_words
    var id = e.currentTarget.dataset.id
    var zid = that.data.zid


    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/serviceList/serviceList?titlme=' + titlme + '&key_words=' + key_words + '&id=' + id + '&zid=' + zid,
    })
  },
})